fix(core): a tolerated skip no longer erases an earlier verdict (#293) - #365
Merged
Conversation
Closes #293. generate_evaluator_result rolled resources up with one variable that every branch wrote to: a failing resource set it False, a tolerated skip set it None, unconditionally. So a violating resource followed by a skipped one reported the evaluator as skipped, the None id was removed from eval_expression, and the violation vanished. A passing resource followed by a skipped one reported skipped too, so a plan with one compliant and one destroyed resource exited 1. Both depended on the order of resource_changes, and a destroyed resource is severity 0, which is tolerated at every error_tolerance, so every terraform_plan attribute policy was exposed on every plan that destroys a resource of the type it checks. The roll-up is now two flags decided once at the end: any failure fails the evaluator; otherwise it passes if at least one resource was actually evaluated; only when every resource was tolerated away is it skipped. The all-skipped case, the hard-failure branches for bare provider errors and above-tolerance severities, and the empty-input case are unchanged. [PASS, skip, PASS] is now True. It used to print "Passed: 0 Failed: 0 Skipped: 1" and exit 1, which read as a tool failure for a plan that was compliant. Regression tests cover both orderings of fail+skip, three shapes of pass+skip, all-skipped, and a bare provider error followed by a skip. Verified against real plans: a compliant bucket next to a destroyed one now exits 0 (was 1); an open security group next to one with no ingress blocks now exits 3 (was 1); an RDS instance with retention 3 next to one with retention unset now exits 3 (was 0).
AkashS0510
requested review from
Akshat0694,
arunim2405 and
refeed
as code owners
September 4, 2026 11:28
|
❌ The last analysis has failed. |
Codecov Report✅ All modified and coverable lines are covered by tests.
🚀 New features to boost your workflow:
|
refeed
approved these changes
Sep 4, 2026
arunim2405
approved these changes
Sep 4, 2026
AkashS0510
added a commit
that referenced
this pull request
Sep 4, 2026
PR #365 changed the roll-up so a tolerated skip no longer erases a sibling's verdict. Both skills now state the fixed behaviour where they used to warn about the bug, and the SSH example's notes say a skipped group leaves the bastion's failure standing. Re-verified: the probe plan that masked the bastion before now exits 3, and a compliant bucket next to a destroyed one exits 0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #293.
The bug
generate_evaluator_resultrolled resources up with one variable that every branch wrote to. A failing resource set itFalse; a tolerated skip set itNone, unconditionally. Two consequences, both order-dependent:Noneid was removed fromeval_expression, so the violation vanished. Under!idthe policy passed.A destroyed resource is severity 0, tolerated at every
error_tolerance, so everyterraform_planattribute policy was exposed on every plan that destroys a resource of the type it checks. Theerror_tolerance: 2idiom ("where the attribute exists, it must be X") was exposed on any plan mixing resources with and without the attribute.The fix
Two flags, decided once at the end:
FalseTrueNoneThe all-skipped case, the hard-failure branches (bare provider error, severity above tolerance) and the empty-input case are unchanged.
[PASS, skip, PASS]is nowTrue; the issue asked for this to be decided here.Verdict change
This changes exit codes on real plans, so CHANGELOG labels it a verdict change under Fixed:
error_tolerance: 2GreaterThanEqualTo 7with tolerance 2Tests
Regression tests for both orderings of fail+skip, three shapes of pass+skip, all-skipped, and a bare provider error followed by a skip. core, cli, providers, platform and the readme tests pass.
tests/tui/test_app.pyhangs onmainas well in this environment and was excluded from the local run.Found while a second agent session exercised the new agent skills (#361) against the engine; those skills carry a warning about this bug that can be removed once this merges.